home *** CD-ROM | disk | FTP | other *** search
/ Delphi Magazine Collection 2001 / Delphi Magazine Collection 20001 (2001).iso / DISKS / Issue48 / Clinic / MonImplU.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1999-05-19  |  1.2 KB  |  49 lines

  1. unit MonImplU;
  2. {$ifdef Ver93} { C++ Builder 1.0x }
  3.   {$define DelphiLessThan4}
  4. {$endif}
  5. {$ifdef Ver100} { Delphi 3.0x }
  6.   {$define DelphiLessThan4}
  7. {$endif}
  8. {$ifdef Ver110} { C++ Builder 3.0x }
  9.   {$define DelphiLessThan4}
  10. {$endif}
  11.  
  12. interface
  13.  
  14. uses
  15.   Windows, ActiveX, ComObj, SMIntf;
  16.  
  17. type
  18.   TSMClient = class(TComObject, ISMClient)
  19.   protected
  20.     function RegisterClient(ID: Integer; Name: PChar;
  21.       Instance, SignalProc: Pointer): WordBool; stdcall;
  22.     function AddStatement(Statement: PChar; Len: Integer): WordBool; stdcall;
  23.   end;
  24.  
  25. implementation
  26.  
  27. uses
  28.   ComServ, MonLibU;
  29.  
  30. { TSMClient }
  31.  
  32. function TSMClient.AddStatement(Statement: PChar; Len: Integer): WordBool;
  33. begin
  34.   Result := MonLibU.WriteRoutine(nil, Statement, Len)
  35. end;
  36.  
  37. function TSMClient.RegisterClient(ID: Integer; Name: PChar; Instance,
  38.   SignalProc: Pointer): WordBool;
  39. var
  40.   WP: TWriteProc;
  41. begin
  42.   Result := MonLibU.RegisterClient(ID, Name, WP, TObject(Instance), SignalProc) <> nil
  43. end;
  44.  
  45. initialization
  46.   TComObjectFactory.Create(ComServer, TSMClient, Class_SMClient,
  47.     'SMClient', '', ciSingleInstance{$ifndef DelphiLessThan4}, tmSingle{$endif});
  48. end.
  49.